<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../config.inc.php");

$_LangPath = 'sixanimals';	//語言檔參數，務必放在最前面
$intLID = (int)$_data["LottoID"];
if(empty($intLID))$intLID = 1;
$intSid = $_data["sid"];

include_once(__Member_Path."/logincheck_nodb.php");
include_once(__Language_Path."/selectlanguage_member.php");
include_once(__Modules_Path."/ChangeTime.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Common_Path."/SysParam.inc.php");
include_once(__Common_Path."/todaygame/Gamble". $intLID .".inc.php");
include_once(__Common_Path."/gambletype/GambleType".$_SESSION[Member_Info] -> GambleType."_".$intLID.".inc.php");
include_once(__Common_Path."/betparam/AnimalsParams_".$intLID.".inc.php");

//取得 TodayGame 資料 六肖 BetType = 30
include_once(__Common_Path."/todaygame/TodayGame".$intLID."_30.inc.php");

$isStop = false;
if (!is_array($_arrTodayGame) || !is_array($_arrGamble)) {
	$isStop = true;
} else {
	list($intGID, $arrGData) = each($_arrGamble);

	//判斷是否有 Game 時間是否過期
	$GameEndDateTime	= $arrGData["GameDate"] .' '. $arrGData["EndGameTime"];
	$NowDateTime		= date("Y-m-d") .' '. date("H:i:s");

	if ($NowDateTime > $GameEndDateTime) {
		$isStop = true;
	} else {
		$isStop = false;
	}
}

$fp = @file(__Membertemplate_Path."/sixanimals.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);

$fp = str_replace("{SerialNo}", ($isStop)?"0":$arrGData["SerialNo"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGData["GameDate"], $fp);
$fp = str_replace("{ShowGameTime}", $arrGData["GameTime"], $fp);
$fp = str_replace("{GambleID}", $intGID, $fp);
$fp = str_replace("{sid}", $intSid, $fp);

$fp = str_replace("{Win}", $_strSame_String[Win], $fp);
$fp = str_replace("{NoWin}", $_strSame_String[NoWin], $fp);

$strCloseClass = "class=\"rt_mt_con_odds_grey\"";
$arrRadio = array(0, 0);
$arrTGame = $_arrTodayGame[$intGID][30];
for($i = 1; $i <= 24; $i++){
	$fp = str_replace("{AnimalsTip".$i."}", $_arrAnimals[$i], $fp);
	$_arrAnimalsParams[$i] = str_replace(", 49", "", $_arrAnimalsParams[$i]);
	$fp = str_replace("{AnimalsParam".$i."}", $_arrAnimalsParams[$i], $fp);

	if($arrTGame[$i]["isStopBet"] || $isStop){
		$fp = preg_replace("/AC".$i."_S.+AC".$i."_E/s", $strCloseClass." disabled ", $fp);
		$fp = str_replace("{AnimalsOdds".$i."}", "&nbsp;", $fp);
		if($i <= 12){
			$arrRadio[0]++;
		}else{
			$arrRadio[1]++;
		}
	}else{
		$fp = str_replace("{AnimalsOdds".$i."}", $arrTGame[$i]["Odds"], $fp);
		$fp = str_replace("{OddsID".$i."}", $arrTGame[$i]["OddsID"], $fp);
	}
}

if($arrRadio[0] > 6 || $isStop)$fp = str_replace("{Radio0}", "disabled", $fp);
if($arrRadio[1] > 6 || $isStop)$fp = str_replace("{Radio1}", "disabled", $fp);

//以下位置不可上下移動
while(list($k, $v) = each($_strSixAnimals)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>